<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品详情页面</title>
    <base th:href="@{/}">
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <link rel="stylesheet" href="../static/css/style.css" th:href="@{/css/style.css}"/>
    <style>
        .card-title {
            font-size: 24px;
            font-weight: bold;
        }
        .card-text {
            font-size: 18px;
        }
        .product-price {
            font-size: 28px;
            color: #007bff;
            font-weight: bold;
        }
        .btn-large {
            display: inline-block;
            padding: 14px 24px;
            font-size: 18px;
            width: 20%;
        }
    </style>

</head>
<body>
<head class="panelBar" th:replace="/common/header::header"></head>

<div class="container mt-4">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <img class="card-img-top" th:src="${good.image}" alt="Product Image" style="width: 100%; max-height: 500px;">
                <div class="card-body">
                    <h2 class="card-title">产品详情</h2>
                    <p class="card-text" th:text="${good.name}">品名</p>
                    <p class="card-text">
                        价格：￥
                        <span class="product-price" th:text="${good.price}"></span>
                        CNY
                    </p>
                    <p class="card-text" th:text="${'库存：' + good.stock}">库存</p>
                    <p class="card-text" th:text="${good.description}">产品描述</p>
                    <hr>

                    <form th:action="@{/cart/add}" method="post">
                        <button type="button" class="btn btn-success btn-large">立即购买</button>
                        <button type="submit" class="btn btn-primary btn-large">加入购物车</button>
                        <div class="form-group" style="width: 10%; margin-top: 2%">
                            <label for="quantity" >购买数量：</label>
                            <input type="number" id="quantity" name="num" class="form-control" value="1" min="1">
                        </div>
                        <input type="hidden" name="goodId" th:value="${good.id}">
                    </form>

                    <a th:href="@{/}" class="btn btn-secondary">返回产品列表页</a>
                </div>
            </div>
        </div>
    </div>
</div>

<head class="panelBar" th:replace="/common/footer::footer"></head>
</body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
</html>